<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/components/person/copper.vue</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\index.html">All files</a> / <a href="index.html">src/components/person</a> copper.vue
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/53</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/14</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/14</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/53</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&lt;template&gt;
  &lt;div class="uploadContainer"
       v-loading='loading'&gt;
&nbsp;
    &lt;div class="cropper"
         id="copperBox"&gt;
      &lt;vueCropper ref="cropper"
                  :img="option.img"
                  :outputSize="option.size"
                  :outputType="option.outputType"
                  :info="true"
                  :full="option.full"
                  :canMove="option.canMove"
                  :canMoveBox="option.canMoveBox"
                  :original="option.original"
                  :autoCrop="option.autoCrop"
                  :autoCropWidth="option.autoCropWidth"
                  :autoCropHeight="option.autoCropHeight"
                  :fixedBox="option.fixedBox"&gt;
      &lt;/vueCropper&gt;
    &lt;/div&gt;
    &lt;div class="footer-btn"&gt;
      &lt;div class="scope-btn"&gt;
        &lt;label class="btn"
               for="uploads"
               style='background: dodgerblue;'&gt;选择图片&lt;/label&gt;
        &lt;input type="file"
               id="uploads"
               style="position:absolute; clip:rect(0 0 0 0);"
               accept="image/png, image/jpeg, image/gif, image/jpg"
               @change="uploadImg($event, 1)"&gt;
        &lt;p class="btn"
           @click="changeScale(1)"&gt;+&lt;/p&gt;
        &lt;p class="btn"
           @click="changeScale(-1)"&gt;-&lt;/p&gt;
        &lt;p class="btn"
           @click="rotateLeft"&gt;↺&lt;/p&gt;
        &lt;p class="btn"
           @click="rotateRight"&gt;↻&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="upload-btn"&gt;
        &lt;p class="btn"
           style="opacity: 0.5;"
           @click='cancelUpload'&gt;取消&lt;/p&gt;
        &lt;p class="btn"
           @click="startUpload()"&gt;确定&lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/template&gt;
&lt;script&gt;
<span class="cstat-no" title="statement not covered" >import config from "../../config.js";</span>
<span class="cstat-no" title="statement not covered" >import VueCropper from 'vue-cropper'</span>
export default {
<span class="fstat-no" title="function not covered" >  data () {</span>
<span class="cstat-no" title="statement not covered" >    return {</span>
      crap: false,
      option: {
        img: '',
        size: 1,
        full: false,
        outputType: 'png',
        canMove: true,
        original: false,
        canMoveBox: true,
        autoCrop: true,
        autoCropWidth: 160,
        autoCropHeight: 160,
        fixedBox: true,
        downImg: '#'
      },
      loading: false,
    }
  },
&nbsp;
  methods: {
<span class="fstat-no" title="function not covered" >    changeScale (num) {</span>
<span class="cstat-no" title="statement not covered" >      num = num || 1</span>
<span class="cstat-no" title="statement not covered" >      this.$refs.cropper.changeScale(num)</span>
    },
<span class="fstat-no" title="function not covered" >    rotateLeft () {</span>
<span class="cstat-no" title="statement not covered" >      this.$refs.cropper.rotateLeft()</span>
    },
<span class="fstat-no" title="function not covered" >    rotateRight () {</span>
<span class="cstat-no" title="statement not covered" >      this.$refs.cropper.rotateRight()</span>
    },
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >    finish (type) { // 输出</span></span>
<span class="cstat-no" title="statement not covered" >      var test = window.open('about:blank')</span>
<span class="cstat-no" title="statement not covered" >      test.document.body.innerHTML = '图片生成中..'</span>
<span class="cstat-no" title="statement not covered" >      if (type === 'blob') {</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >        this.$refs.cropper.getCropBlob((data) =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" >          var img = window.URL.createObjectURL(data)</span>
<span class="cstat-no" title="statement not covered" >          this.model = true</span>
<span class="cstat-no" title="statement not covered" >          this.modelSrc = img</span>
        })
      } else {
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >        this.$refs.cropper.getCropData((data) =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" >          this.model = true</span>
<span class="cstat-no" title="statement not covered" >          this.modelSrc = data</span>
        })
      }
    },
<span class="fstat-no" title="function not covered" >    cancelUpload () {</span>
<span class="cstat-no" title="statement not covered" >      this.$emit('success', false);</span>
    },
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >    startUpload () {</span></span>
<span class="cstat-no" title="statement not covered" >      this.loading = true</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >      this.$refs.cropper.getCropBlob((data) =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" >        let uploadFile = document.getElementById("uploads").files[0];</span>
<span class="cstat-no" title="statement not covered" >        console.log(uploadFile)</span>
<span class="cstat-no" title="statement not covered" >        let formFile = new FormData();</span>
<span class="cstat-no" title="statement not covered" >        formFile.append("file", uploadFile)</span>
<span class="cstat-no" title="statement not covered" >        var url = config.baseUrl + 'emergency/v1.0/personal/photos?userId=' + localStorage.userid</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >        this.$axios.post(url, formFile, {</span></span>
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        }).then((res) =&gt; {
<span class="cstat-no" title="statement not covered" >          this.loading = false</span>
<span class="cstat-no" title="statement not covered" >          if (res.data.meta.success) {</span>
<span class="cstat-no" title="statement not covered" >            this.$message.success(res.data.meta.message)</span>
<span class="cstat-no" title="statement not covered" >            this.$emit('success', false);</span>
<span class="cstat-no" title="statement not covered" >            this.option.img = ''</span>
          } else {
<span class="cstat-no" title="statement not covered" >            this.$message.warning(res.data.meta.message)</span>
          }
<span class="fstat-no" title="function not covered" >        }).catch(response =&gt; {</span>
<span class="cstat-no" title="statement not covered" >          console.log(response);</span>
        });
      })
    },
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >    uploadImg (e, num) { //上传图片</span></span>
<span class="cstat-no" title="statement not covered" >      this.option.img</span>
<span class="cstat-no" title="statement not covered" >      var file = e.target.files[0]</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >      this.test = file</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >      if (!/\.(gif|jpg|jpeg|png|bmp|GIF|JPG|PNG)$/.test(e.target.value)) {</span>
<span class="cstat-no" title="statement not covered" >        alert('图片类型必须是.gif,jpeg,jpg,png,bmp中的一种')</span>
<span class="cstat-no" title="statement not covered" >        return false</span>
      };
<span class="cstat-no" title="statement not covered" >      var reader = new FileReader()</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >      reader.onload = (e) =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" >        let data</span>
<span class="cstat-no" title="statement not covered" >        if (typeof e.target.result === 'object') { // 把Array Buffer转化为blob 如果是base64不需要</span>
<span class="cstat-no" title="statement not covered" >          data = window.URL.createObjectURL(new Blob([e.target.result]))</span>
        } else {
<span class="cstat-no" title="statement not covered" >          data = e.target.result</span>
        }
<span class="cstat-no" title="statement not covered" >        if (num === 1) {</span>
<span class="cstat-no" title="statement not covered" >          this.option.img = data</span>
<span class="cstat-no" title="statement not covered" >        } else if (num === 2) {</span>
<span class="cstat-no" title="statement not covered" >          this.example2.img = data</span>
        }
      } // 转化为base64
<span class="cstat-no" title="statement not covered" >      reader.readAsDataURL(file) // 转化为blob reader.readAsArrayBuffer(file)</span>
    }
  }
}
&lt;/script&gt;
&lt;style type="text/less"&gt;
.uploadContainer {
  height: 300px;
  width: 100%;
}
.btn {
  width: 80px;
  line-height: 30px;
  border-radius: 2px;
  float: left;
  background: #2db0fd;
  color: #fff;
  text-align: center;
  margin-right: 10px;
  font-size: 14px;
}
.btn:hover {
  cursor: pointer;
}
.scope-btn {
  width: 450px;
  margin: 30px auto;
}
.upload-btn {
  width: 200px;
  position: absolute;
  bottom: 20px;
  right: 20px;
}
#copperBox {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  background: #000;
  position: relative;
  overflow: hidden;
}
&lt;/style&gt;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu Jun 20 2019 14:29:28 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\sorter.js"></script>
</body>
</html>
